package com.smart.fourteen.mybatis.mapper;

import com.smart.fourteen.mybatis.dao.TopicDao;
import com.smart.fourteen.mybatis.model.Topic;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author junrui.wang
 * @create 2019/11/13
 */
public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("com/smart/fourteen/mybatis/sessiontemplate/applicationContext-mybatis.xml");
        SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) ac.getBean("sqlSessionTemplate");
        TopicDao topicDao = sqlSessionTemplate.getMapper(TopicDao.class);
        Topic topic = topicDao.getTopic(1);
        System.out.println(topic);


    }
}
